<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/24
 * Time: 16:14
 */

namespace app\api\v1\controller;

use think\Controller;
use think\Request;
use think\Config;

class Express extends Controller
{
    /**
     * 快递鸟查询快递
     * @param Request $request
     */
    public function Express(Request $request)
    {
        $config = Config('kdn.kuaidiniao');

        $Kdniao = new \static7\Kdniao($config);
        //在接收快递单号之前需要进行处理，避免个别用户输入中文进行查询
        $number = $request->param('sn');
        // dump($number);
        //直接输入快递单号
        $data = $Kdniao->getBiscernByWaybill($number);
        //或者输入快递公司的代号和快递单号
        //$data=$Kdniao->getExpressInfo('SF',$number);
        dump($data); //返回的是json
        //获取快递公司名称
        $company = $Kdniao->getShipperName($data);
        dump($company);
    }
}